package com.one.consumer.reserve.ui.binder;

import android.support.annotation.NonNull;
import android.view.View;
import android.widget.ImageView;

import com.one.common.manager.imageloader.ILoader;
import com.one.common.manager.imageloader.LoaderManager;
import com.one.common.model.http.NetConstant;
import com.one.common.view.multitytype.adapter.BaseItemBinder;
import com.one.common.view.multitytype.adapter.BaseViewHolderMulti;
import com.one.common.view.preview.PreviewPicActivity;
import com.one.consumer.R;
import com.one.consumer.reserve.model.item.CaseDetailItem;
import com.one.consumer.reserve.model.item.ProgramImageItem;

/**
 * author ：zhulunjun
 * email  ：zhulunjun@qq.com
 * date   ：2018/10/21 下午10:12
 * description ：
 **/
public class CaseDetailBinder extends BaseItemBinder<ProgramImageItem> {
    public CaseDetailBinder() {
        super(R.layout.item_case_detail);
    }

    @Override
    protected void bindView(@NonNull BaseViewHolderMulti holder, @NonNull ProgramImageItem item) {
        ImageView imageView = holder.getView(R.id.iv_bg);
        ILoader.Options options = ILoader.Options.roundOptions(8);
        options.setCenterCrop(true);
        LoaderManager.getLoader().loadNet(imageView, NetConstant.IMG_HOST + item.getProgramme_img(),
                options);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                // 查看大图
                PreviewPicActivity.starSinglePreview(mContext,
                        NetConstant.IMG_HOST + item.getProgramme_img());
            }
        });
    }
}
